﻿using BCEntity.WeChatComponent.WeChatUserInfo;
using System;
using System.Collections.Generic;
using System.Text;

namespace BCData.WeChatComponent.WeChatUserInfo
{
    /// <summary>
    /// 微信用户信息数据处理接口
    /// </summary>
    public interface IWeChatUserInfoData
    {
        /// <summary>
        /// 检查用户是否已经存在
        /// </summary>
        /// <param name="openId">OpenId</param>
        /// <returns></returns>
        bool CheckUserExists(string openId);
        /// <summary>
        /// 插入OpenId
        /// </summary>
        /// <param name="openIds">用户OpenId列表</param>
        void AddOpenIds(string[] openIds);
        /// <summary>
        /// 获取未获取信息的100用户OpenIds
        /// </summary>
        /// <param name="index">起始值</param>
        /// <returns></returns>
        IEnumerable<string> GetHundredUserOpenIds(int index); 
        /// <summary>
        /// 添加微信用户信息
        /// </summary>
        /// <param name="weChatUserInfoEntity">微信用户信息</param>
        void Add(WeChatUserInfoEntity weChatUserInfoEntity);
        /// <summary>
        /// 更新微信用户信息
        /// </summary>
        /// <param name="weChatUserInfoEntity">微信用户信息</param>
        void Update(WeChatUserInfoEntity weChatUserInfoEntity);
        /// <summary>
        /// 删除微信用户信息
        /// </summary>
        /// <param name="openId">唯一码</param>
        void Delete(string openId);
        /// <summary>
        /// 获取微信用户信息
        /// </summary>
        /// <param name="openId">OpenId</param>
        /// <returns></returns>
        WeChatUserInfoEntity GetEntity(string openId);
        /// <summary>
        /// 批量获取微信用户信息
        /// </summary>
        /// <param name="openIds">OpenId列表</param>
        /// <returns></returns>
        IEnumerable<WeChatUserInfoEntity> Get(List<string> openIds);
        
        /// <summary>
        /// 获取微信用户列表
        /// </summary>
        /// <param name="openUnionId">开启了公众平台接入</param>
        /// <param name="name">用户名</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="tagId">标签Id</param>
        /// <param name="subscribeScene">关注渠道</param>
        /// <param name="remark">用户备注名</param>
        /// <param name="phone">用户手机号</param>
        /// <param name="country">国家</param>
        /// <param name="province">省份</param>
        /// <param name="city">城市</param>
        /// <param name="role">角色</param>
        /// <param name="ascending">排序</param>
        /// <param name="dataCount">数据总数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        IEnumerable<WeChatUserInfoEntity> Get(bool openUnionId, string name, DateTime? start, DateTime? end,int? tagId, string subscribeScene, string remark, string phone, string country, string province , string city, string role, bool? ascending, out int dataCount, int pageIndex = 1, int pageSize = 10);

        /// <summary>
        /// 获取微信用户信息
        /// </summary>
        /// <param name="unionId">公众平台Id</param>
        /// <returns></returns>
        WeChatUserInfoEntity GetWechatUserByUnionId(string unionId);

        /// <summary>
        /// 获取微信信息与用户信息
        /// </summary>
        /// <param name="user">当前登录用户</param>
        /// <param name="unionId">公众平台Id</param>
        /// <returns></returns>
        WeChatUserInfoEntity Get(string userId, string unionId);
       
        /// <summary>
        /// 根据UserId获取微信用户信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        WeChatUserInfoEntity GetWechatUserByUserId(string userId);
    }
}
